package com.oe.dubbo;



import com.alibaba.fastjson.JSON;
import com.oe.context.UserContext;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

@Activate(group = {CommonConstants.CONSUMER})
public class TransportFilter implements Filter {

    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        RpcContext.getContext().setAttachment(UserContext.USER_KEY, JSON.toJSONString(UserContext.getContext().getCurrUser()));
        return invoker.invoke(invocation);
    }
}
